package ProyectoX;

import java.awt.Graphics;
import java.awt.Image;

import javax.swing.ImageIcon;
import javax.swing.JLabel;

public class RepGrafica extends JLabel {


	protected Image miImagen;

	public RepGrafica(Image imagen) {
		super();
		miImagen = imagen;
		setVisible(true);
		setSize( miImagen.getWidth(null), miImagen.getHeight(null));

	}

	public void cambiarImagen(Image imagen) {
		miImagen = imagen;
		setSize( miImagen.getWidth(null), miImagen.getHeight(null));

	}

	public void dibujar(Graphics grafico, int posX, int posY) {
		setIcon(new ImageIcon(miImagen));
		setLocation(posX, posY);
		super.paintComponents(grafico);
	}
	
    public void eliminar(Graphics grafico){
    	setIcon(null);
    	repaint();
    }

	public Image getImagen() {

		return miImagen;
	}

	
}
